<script type="text/javascript">
$(document).ready(function(){   
        $('.simplemodal-wrap').css('overflow', 'auto'); // or try jQuery.modal.update();
});
</script>
<div class="grid_container">
    <div class="grid_12">
        <div class="widget_wrap">
           
                        </br>
                        </br>      
            <div class="widget_content">                           
                        <ul>
                                              
                        </ul>
                        </div>
                        <span class="clear"></span>
                <table border="1" rules="cols" class="wtbl_list" id="table1">
                                    </br>
                                    </br>
                                   
                                   <thead>
                    
                                                <tr>
                                                <th>Fecha</th>
                                                <th>Documento</th>
                                                <th>Cliente</th>
                                                <th>Total</th>                                                
                                                </tr>
                                </thead>
                    <tbody>
                    <?php $i = 0;
                    $total=0; ?>
                    <?php foreach ($kardex as $p) : ?>
                        <?php $i++; 
                        ?>
                        <tr class="<?=($i%2==0) ? "tr_even" : "tr_odd" ?>">
                            <td align="center"><? $datei = $p->date;
                                                            $date = str_replace('-', '/', $datei);
                                                            $datef = date("d/m/Y", strtotime($date) );
                                                            echo $datef; ?></td>                                                        
                                                            <td align="center"><? echo "GV ".$p->document_code; ?></td>
                                                       <td align="center"><? echo "GV ".$p->cliente; ?></td>
                        <td align="center"><?=$p->amount; 
                        $total =$total+$p->amount; ?></td>
                        </tr>
                                                
                    <?php endforeach; ?>
                                                <script>
                                                    $(document).ready( function() 
                                                        {   for(i=1;i<=<?echo $i?>;i++)
                                                                {
                                                                    var op ="operacion";
                                                                    var num = i;
                                                                    var fun ="();";
                                                                    var funcion = op.concat(num,fun);
                                                                    eval(funcion);
                                                                }                                                                                                                          
                                                        } );
                                                   
                                                </script>
                    </tbody>
            
                            <span class="clear"></span>

                </table>
                          <input type="text" name="total" id="total" placeholder="0.00" value="<?php                           
                               echo $total;                           
                    ?>" readonly="true" style=" text-align:center; width: 100px; margin-right:10px; float: right; background: #D0D0D0; font-family: arial; font-size: 15px; font-weight: bold;">
            </div>
        </div>
    </div>
    <span class="clear"></span>
</div>